package com.howso.cloud.changan.user.db.repository.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.howso.cloud.changan.user.db.mapper.ChanganUserMapper;
import com.howso.cloud.changan.user.entity.ChanganRole;
import com.howso.cloud.changan.user.entity.ChanganUser;
import com.howso.cloud.changan.user.repository.ChanganUserRepository;
import com.howso.cloud.ddd.repository.impl.BaseMybatisRepository;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.Set;

@Service
public class ChanganUserRepositoryImpl extends BaseMybatisRepository<ChanganUserMapper, ChanganUser> implements ChanganUserRepository {
    @Override
    public ChanganUser selectByUsername(String username) {
        List<ChanganUser> users = baseMapper.selectList(
                new QueryWrapper<ChanganUser>().eq("username", username)
        );
        if(users.size()==0){
            return  new ChanganUser();
        }
        return users.get(0);
    }

    @Override
    public ChanganUser selectByMobile(String mobile) {
        return null;
    }

    @Override
    public ChanganUser selectByOpenId(String openId) {
        return null;
    }

    @Override
    public void setRoleToUser(Long id, Set<Long> roleIds) {

    }

    @Override
    public ChanganUser updatePassword(Long id, String oldPassword, String newPassword) {
        return null;
    }

    @Override
    public List<ChanganRole> findRolesByUserId(Long userId) {
        return null;
    }

    @Override
    public Boolean updateEnabled(Map<String, Object> params) {
        return null;
    }

    @Override
    public Boolean saveOrUpdateUser(ChanganUser user) throws Exception {
        return null;
    }

    @Override
    public boolean delUser(Long id) {
        return false;
    }
}
